<template>
  <div class="header">
    <div class="logo">
        <img src="../../assets/header/logo2.png" alt="">
    </div>
    <!--center-->
    <div class="nav" >
            <ul>
                <li :class="cliked1" @click="ifClicked('cliked1')">
                    <a>
                        <img src="../../assets/header/beforeMain.svg" alt="" v-show="cliked1=='uncliked'">
                        <img src="../../assets/header/afterMain.svg" alt="" v-show="cliked1=='cliked'">
                        <span>功能概述</span>
                    </a>
                </li>
                <li :class="cliked2" @click="ifClicked('cliked2')">
                    <a >
                        <img src="../../assets/header/beforeTv.svg" alt="" v-show="cliked2=='uncliked'">
                        <img src="../../assets/header/afterTv.svg" alt="" v-show="cliked2=='cliked'">
                        <span>视频展区</span>
                    </a>
                </li>
                <li :class="cliked3" @click="ifClicked('cliked3')">
                    <a >
                        <img src="../../assets/header/beforeBall.svg" alt="" v-show="cliked3=='uncliked'">
                        <img src="../../assets/header/afterBall.svg" alt="" v-show="cliked3=='cliked'">
                        <span>品牌中心</span>
                    </a>
                </li>
            </ul>
    </div>
    <div class="rightHeader">
        <a class="loginbatton">
            欢迎您！{{loginName}}!
        </a>
        <button @click="push()">进入主页</button>
    </div>
  </div>
</template>

<script>
export default {
    name:"homeHeader",
    data() {
      return {
        loginType:1,
        loginName:"",
        adver_name:"",
        adver_message:{},
        cliked1:"cliked",
        cliked2:"uncliked",
        cliked3:"uncliked"
      };
    },
    methods:{
        ifClicked(checkClik){
            if(checkClik=='cliked1'){
                this.cliked2="uncliked"
                this.cliked3="uncliked"
                this.cliked1="cliked"
                this.$router.push({path:'/'})
            }else if(checkClik=='cliked2'){
                this.cliked2="cliked"
                this.cliked1="uncliked"
                this.cliked3="uncliked"
                 this.$router.push({path:'/VedioShow'})
            }else{
                this.cliked1="uncliked"
                this.cliked2="uncliked"
                this.cliked3="cliked"
                this.$router.push({path:'/adver_center'})
            }
        },
        push(){
            console.log(this.loginType)
            if(this.loginType==1){
                this.$router.push({path:'/producer_space'})
            }
            else{
                this.$router.push({path:'/adver_space'})
            }
        }
    },
    mounted(){
        console.log(window.location.pathname)
        this.adver_message=JSON.parse(window.sessionStorage.getItem('userInfo'))
        //判断是广告商还是创作者，广告商是0，创作者是1
        if(this.adver_message.cname){
            this.loginName=this.adver_message.cname;
            this.loginType=1;
            window.sessionStorage.setItem('loginType',JSON.stringify(1));
        }
        else{
            this.loginName=this.adver_message.aname;
            this.loginType=0;
             window.sessionStorage.setItem('loginType',JSON.stringify(0));
        }
        console.log(this.adver_message)
    }
}
</script>

<style >
@import url('../../style/header.css');
</style>